<template>
	<div>
	<van-nav-bar
	  title="成绩查询"
	  left-text="返回"
	  left-arrow
	  @click-left="onClickLeft"
	/>
	<div class="title" ><span @click="showTerm()"> 全部学期 <van-icon name="arrow-down" /></span></div>
	<van-action-sheet v-model:show="show" :actions="term"  @select="onSelect" />
	<div class="scoreList" v-for="item in student">
		<div class="term"><van-icon color="#1989fa" name="tosend" /><span>{{item.courseclass.term}}</span></div>
		<div class="score">
			<div class="courseName"><span>{{item.course.courseName}}</span></div>
			
			<div class="value"><span>{{item.zongpingScore}}</span><!-- <van-icon name="arrow-down" /> --></div>
		</div>
		<van-divider  :style="{ color: '#1989fa', borderColor: '#1989fa' }"></van-divider>
	</div>
	</div>
</template>

<script>
	import {getInfo,getTerm} from '@/api/score'
  export default {
	    data() {
	   	 return{
			 show:false,
			 // actions:[{name:'选项一'},{name:'选项二'}],
			 student:[],
			 studentId:this.$route.query.index,
			 userId:this.$store.getters.userId,
			 term:[]
		 }
	   },
		created() {
			this.getStudentInfo()
		},
		methods:{
			onClickLeft(){
				this.$router.push('/person')
			},
			async showTerm(){
				this.show=true
				const result=await getTerm(this.userId);
				if(result.code==200){
					console.log(result)
					this.term=result.data
					
				}
			},
			 onSelect(){
				this.show=false
			
			},
			async getStudentInfo(){
				const result=await getInfo(this.studentId);
				if(result.code==200){
					console.log(result)
					this.student=result.data
				}
			}
		}
	}
</script>
    
<style scoped>
	.title{
		height: 60px;
		background-color: cornflowerblue;
		text-align: center;
		padding-top: 20px;
		color: aliceblue;
	}
	.scoreList{
		padding-top: 3px;
	}
	.scoreList .term{
		padding-left: 5px;
		background-color: darkgray;
		
	}
	.score{
		padding-left: 5px;
		display: flex;
	}
	.score .courseName{
		font-size: 22px;
	}
	.score .value{
		padding-left: 250px;
		padding-top: 6px;
		font-size: 18px;
	}
	.term span{
		padding-left: 8px;
		font-size: 20px;
	}
</style>